package com.kede.app.domain;

import com.kede.app.service.dto.OrderAddrDto;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
* @description /
* @author Pr.li
* @date 2023-05-12
**/
@Entity
@Data
@Table(name="sy_leescore_order")
public class LeescoreOrder implements Serializable {
    /**
    * 订单ID
    */
    @ApiModelProperty(value = "订单ID")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 用户ID
    */
    @ApiModelProperty(value = "用户ID")
    @Column(name = "`uid`")
    private Integer uid;

    @Transient
    private String username;
    @Transient
    private String userphone;

    @Transient
    private List<LeescoreOrderGoods> leescoreOrderGood;
    /**
    * 收货地址
    */
    @ApiModelProperty(value = "收货地址")
    @Column(name = "`address_id`")
    private Integer addressId;
    /**
    * 订单号
    */
    @ApiModelProperty(value = "订单号")
    @Column(name = "`order_id`",nullable = false)
    @NotBlank
    private String orderId;
    /**
    * 回执单号
    */
    @ApiModelProperty(value = "回执单号")
    @Column(name = "`trade_id`")
    private String tradeId;
    /**
    * 创建时间
    */
    @ApiModelProperty(value = "创建时间")
    @Column(name = "`createtime`")
    private Integer createtime;
    /**
    * 付款状态:0=未付款,1=已付款,2=已退款
    */
    @ApiModelProperty(value = "付款状态:0=未付款,1=已付款,2=已退款")
    @Column(name = "`pay`")
    private Integer pay;
    /**
    * 订单状态:-3=异常订单,-2=驳回, -1=取消订单,0=未支付,1=已支付,2=已发货,3=已签收,4=退货中,5=已退款
    */
    @ApiModelProperty(value = "订单状态:-3=异常订单,-2=驳回, -1=取消订单,0=未支付,1=已支付,2=已发货,3=已签收,4=退货中,5=已退款")
    @Column(name = "`status`")
    private Integer status;
    /**
    * 付款时间
    */
    @ApiModelProperty(value = "付款时间")
    @Column(name = "`paytime`")
    private Integer paytime;
    /**
    * 支付方式:score=积分支付,money=余额支付
    */
    @ApiModelProperty(value = "支付方式:score=积分支付,money=余额支付")
    @Column(name = "`paytype`")
    private String paytype;
    /**
    * 1
    */
    @ApiModelProperty(value = "1")
    @Column(name = "`isdel`")
    private Integer isdel;
    /**
    * 备注
    */
    @ApiModelProperty(value = "备注")
    @Column(name = "`other`")
    private String other;
    /**
    * 虚拟券序列号
    */
    @ApiModelProperty(value = "虚拟券序列号")
    @Column(name = "`virtual_sn`")
    private String virtualSn;
    /**
    * 虚拟券名称
    */
    @ApiModelProperty(value = "虚拟券名称")
    @Column(name = "`virtual_name`")
    private String virtualName;
    /**
    * 发货时间
    */
    @ApiModelProperty(value = "发货时间")
    @Column(name = "`virtual_go_time`")
    private Integer virtualGoTime;
    /**
    * 签收时间
    */
    @ApiModelProperty(value = "签收时间")
    @Column(name = "`virtual_sign_time`")
    private Integer virtualSignTime;
    /**
    * 支付积分
    */
    @ApiModelProperty(value = "支付积分")
    @Column(name = "`score_total`")
    private BigDecimal scoreTotal;
    /**
    * 支付货币
    */
    @ApiModelProperty(value = "支付货币")
    @Column(name = "`money_total`")
    private BigDecimal moneyTotal;
    /**
    * 回馈备注
    */
    @ApiModelProperty(value = "回馈备注")
    @Column(name = "`result_other`")
    private String resultOther;
    /**
    * 实际支付积分
    */
    @ApiModelProperty(value = "实际支付积分")
    @Column(name = "`trade_score`")
    private BigDecimal tradeScore;
    /**
    * 实际付款
    */
    @ApiModelProperty(value = "实际付款")
    @Column(name = "`trade_money`")
    private BigDecimal tradeMoney;
    /**
    * 实际付款时间
    */
    @ApiModelProperty(value = "实际付款时间")
    @Column(name = "`trade_time`")
    private String tradeTime;
    /**
    * 自动清理:0=清理,1=不清理
    */
    @ApiModelProperty(value = "自动清理:0=清理,1=不清理")
    @Column(name = "`auth_clear_level`")
    private Integer authClearLevel;
    /**
    * 订单处理结果
    */
    @ApiModelProperty(value = "订单处理结果")
    @Column(name = "`pay_msg`")
    private String payMsg;
    /**
    * 
    */
    @ApiModelProperty(value = "weigh")
    @Column(name = "`weigh`")
    private Integer weigh;
    /**
    * 
    */
    @ApiModelProperty(value = "updatetime")
    @Column(name = "`updatetime`")
    private Integer updatetime;


    /**
     * 收货信息
     */
    @Transient
    private OrderAddrDto orderAddrDto;

    public void copy(LeescoreOrder source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
